package com.shenmazong.servershopuser.user.controller;


import com.shenmazong.comm.utils.ResultResponse;
import com.shenmazong.comm.vo.AdminVO;
import com.shenmazong.servershopuser.user.service.ITbAdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @description 系统管理员控制器
 * @author 军哥
 * @date 2021/7/16 22:11
 * @version 1.0
 */
@RestController
@RequestMapping("/admin")
public class TbAdminController {

    @Autowired
    ITbAdminService iTbAdminService;

    /**
     * @description 添加管理员接口
     * @params [admin]
     * @return com.shenmazong.comm.utils.ResultResponse
     * @author 军哥
     * @date 2021/7/16 22:12
     */
    @PostMapping(value = "/add")
    public ResultResponse add(@RequestBody AdminVO admin) {
        return iTbAdminService.add(admin);
    }

    @PostMapping(value = "/set")
    public ResultResponse set(@RequestBody AdminVO admin) {
        return iTbAdminService.set(admin);
    }

    @PostMapping(value = "/del")
    public ResultResponse del(@RequestBody AdminVO admin) {
        return iTbAdminService.del(admin);
    }

    @PostMapping(value = "/list/{from}/{size}")
    public ResultResponse listByPage(@PathVariable("from") Integer from, @PathVariable("size") Integer size) {
        return iTbAdminService.listByPage(from, size);
    }

    @PostMapping(value = "/login")
    public ResultResponse login(@RequestBody AdminVO admin) {
        return iTbAdminService.login(admin);
    }
}
